home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr46 / wdasm17.zip / HELLO.C next >
C/C++ Source or Header  |  1992-11-15  |  2KB  |  67 lines

  1. /* WDASM Example Disassembly Program */
  2.  
  3. #include <windows.h>
  4.  
  5. long FAR PASCAL WndProc( HWND, WORD, WORD, LONG);
  6.  
  7. int PASCAL WinMain( HANDLE hInstance, HANDLE hPrevInstance,
  8.             LPSTR lpszCmdParam, int nCmdShow)
  9.  
  10. {    static    char    szAppName[] = "Windows Disassembler Example";
  11.     HWND    hwnd;
  12.     MSG    msg;
  13.     WNDCLASS wndclass;
  14.  
  15.     if( !hPrevInstance)
  16.     {    wndclass.style = CS_HREDRAW | CS_VREDRAW;
  17.         wndclass.lpfnWndProc = WndProc;
  18.         wndclass.cbClsExtra = 0;
  19.         wndclass.cbWndExtra = 0;
  20.         wndclass.hInstance = hInstance;
  21.         wndclass.hIcon = LoadIcon( NULL, IDI_APPLICATION);
  22.         wndclass.hCursor = LoadCursor( NULL, IDC_ARROW);
  23.         wndclass.hbrBackground = GetStockObject( WHITE_BRUSH);
  24.         wndclass.lpszMenuName = NULL;
  25.         wndclass.lpszClassName = szAppName;
  26.         RegisterClass( &wndclass);
  27.     }
  28.     hwnd = CreateWindow( szAppName,        // lpClassName
  29.                  "Windows Disassembler Example",    // lpWindowName
  30.                  WS_OVERLAPPEDWINDOW,       // dwStyle
  31.                  CW_USEDEFAULT,             // X
  32.                  CW_USEDEFAULT,             // Y
  33.                  CW_USEDEFAULT,             // nWidth
  34.                  CW_USEDEFAULT,             // nHeight
  35.                  NULL,                      // hWndParent
  36.                  NULL,                      // hMenu
  37.                  hInstance,                 // hInstance
  38.                  NULL);                     // lpParam
  39.     ShowWindow( hwnd, nCmdShow);
  40.     UpdateWindow( hwnd);
  41.     while( GetMessage( &msg, NULL, 0, 0))
  42.     {    TranslateMessage( &msg);
  43.         DispatchMessage( &msg);
  44.     }
  45.     return msg.wParam;
  46. }
  47.  
  48. long FAR PASCAL WndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam)
  49. {    HDC    hdc;
  50.     PAINTSTRUCT ps;
  51.     RECT    rect;
  52.  
  53.     switch( message)
  54.     {    case WM_PAINT:
  55.             hdc = BeginPaint( hwnd, &ps);
  56.             GetClientRect( hwnd, &rect);
  57.             DrawText( hdc, "Congratulations, it works!", -1, &rect,
  58.                   DT_CENTER | DT_VCENTER | DT_SINGLELINE);
  59.             EndPaint( hwnd, &ps);
  60.             return 0;
  61.         case WM_DESTROY:
  62.             PostQuitMessage( 0);
  63.             return 0;
  64.     }
  65.     return DefWindowProc( hwnd, message, wParam, lParam);
  66. }
  67.